package Summative;

import java.awt.event.*;
import javax.swing.*;

public class MenuVectorListener implements ActionListener
{
  JMenuItem item;
  VectorList list;
  JTextField field;
  
  public MenuVectorListener(JMenuItem item, VectorList list, JTextField field)
  {
    this.item = item;
    this.list = list;
    this.field = field;
  }
  
  public void actionPerformed(ActionEvent e)
  {
    
    Vector vector = (list.getVector((Integer.parseInt(item.getText()))-1));
    String bob = vector.getUnitVec();
    field.setText(bob);
  }
}